{% extends "base.html" %}

{% block content %}
	<div>
		<h1>
			<ul class="breadcrumb">
				<li class="active"><a href="{{ "user"|url(u.name) }}">{{ u }}</a></li>
			</ul>
		</h1>
	</div>

	<div class="row">
		<div class="span6">
			<table class="table">
				<tr><td>member since</td><td>{{ u.register_date|sdate }}</td></tr>
				<tr><td>journals</td><td>{{ u.journal_count }}</td></tr>
				<tr><td>entries</td><td>{{ u.entry_count }}</td></tr>
				<tr><td>characters</td><td>{{ u.chars }}</td></tr>
				<tr><td>words</td><td>{{ u.words }}</td></tr>
				<tr><td>sentences</td><td>{{ u.sentences }}</td></tr>
				<tr><td>entries per week</td><td>{{ u.freq_entries|floatformat }}</td></tr>
				<tr><td>characters per week</td><td>{{ u.freq_chars|floatformat }}</td></tr>
				<tr><td>words per week</td><td>{{ u.freq_words|floatformat }}</td></tr>
				<tr><td>sentences per week</td><td>{{ u.freq_sentences|floatformat }}</td></tr>
				{% if u.last_entry %}<tr><td>last entry edited</td><td>{{ u.last_entry|sdate }}</td></tr>{% endif %}
				{% if u.first_entry %}<tr><td>first entry edited</td><td>{{ u.first_entry|sdate }}</td></tr>{% endif %}
				{% if u.entry_days %}<tr><td>entries spanning</td><td>{{ u.entry_days }} day{{ u.entry_days|pluralize }}</td></tr>{% endif %}
			</table>
		</div>

		<div class="span6">
			<div class="row">
				<div class="span2">
					<img src="{{ u.gravatar(50) }}" alt="{{ u }}">
				</div>

				<div class="span2 offset2">
					{% if user and not thisuser %}
						{% if not is_following %}
							<a href="{{ "follow"|url(u.name) }}" class="btn">follow</a>
						{% else %}
							<a href="{{ "follow"|url(u.name) }}?unfollow" class="btn">unfollow</a>
						{% endif %}
					{% endif %}
					{% if thisuser %}
						<a href="{{ "new-journal"|url }}" class="btn btn-primary">new journal</a>
					{% endif %}
				</div>
			</div>

			<div class="row">
				<div class="span6">
					<h1></h1>
				</div>
			</div>

			<div class="row">
				<div class="span2">
					<h2>{{ u.journal_count }}</h2>
					<span>journal{{ u.journal_count|pluralize }}</span>
				</div>
				<div class="span2">
					<h2>{{ followers|length }}</h2>
					<span>follower{{ followers|length|pluralize }}</span>
				</div>
				<div class="span2">
					<h2>{{ following|length }}</h2>
					<span>following</span>
				</div>
			</div>

			<div class="row">
				<div class="span6">
					<h1></h1>
				</div>
			</div>

			<div class="row">
				<div class="span6">
					<h3><a href="{{ "following"|url(u.name) }}">{{ u.name }}'s following</a></h3>
				</div>
			</div>

		</div>
	</div>

	<hr>

	<div class="row">
		<div class="span6">
			<h2>{{ u }}'s journals</h2>

			{% include "journals.html" %}
		</div>

		<div class="span6">
			<h2>activity <small><a href="{{ "user-feeds"|url(u.name) }}"><img src="/static/images/feed.png" class="feed-img" alt="feed">rss feed</a></small></h2>
			{% for a in activities %}
				<p>{% if a.img %}<img src="{{ a.img }}" alt="{{ a.user }}"> {% endif %}<a href="{{ "user"|url(a.user) }}">{{ a.user }}</a> {{ a.get_action()|safe }} {{ a.date|timesince }}</p>
			{% endfor %}
		</div>
	</div>
{% endblock %}
